Skip to content

[fix][fn] fix broken function-go test - #22260

Merged
merlimat merged 1 commit into
apache:masterfrom
pgier:fix-function-go-test
Mar 13, 2024
Merged

[fix][fn] fix broken function-go test#22260
merlimat merged 1 commit into
apache:masterfrom
pgier:fix-function-go-test

Conversation

@pgier

@pgier pgier commented Mar 13, 2024

Copy link
Copy Markdown
Contributor

Upgrade the prometheus client_golang library which changes the format of the metric output to match the current tests.

Motivation

A previous upgrade (#20579) to the prometheus client library broke one of the tests because the spacing changes in the serialized metric output. The specifc commit in prometheus that caused this change is here: prometheus/client_golang#955

Version v1.15.1 of the prometheus client lib changes the spacing back to what it was in v1.11.0. However, it seems that this spacing is not consistent between versions, so we may want to make the test more flexible in the future to avoid hitting this issue again in future upgrades.

=== RUN   TestExampleSummaryVec
    stats_test.go:149:
        	Error Trace:	/Users/paulgier/projects/apache/pulsar/pulsar-function-go/pf/stats_test.go:149
        	Error:      	Not equal:
        	            	expected: "name: \"pond_temperature_celsius\"\nhelp: \"The temperature of the frog pond.\"\ntype: SUMMARY\nmetric: {\n  label: {\n    name: \"species\"\n    value: \"leiopelma-hochstetteri\"\n  }\n  summary: {\n    sample_count: 0\n    sample_sum: 0\n    quantile: {\n      quantile: 0.5\n      value: nan\n    }\n    quantile: {\n      quantile: 0.9\n      value: nan\n    }\n    quantile: {\n      quantile: 0.99\n      value: nan\n    }\n  }\n}\nmetric: {\n  label: {\n    name: \"species\"\n    value: \"lithobates-catesbeianus\"\n  }\n  summary: {\n    sample_count: 1000\n    sample_sum: 31956.100000000017\n    quantile: {\n      quantile: 0.5\n      value: 32.4\n    }\n    quantile: {\n      quantile: 0.9\n      value: 41.4\n    }\n    quantile: {\n      quantile: 0.99\n      value: 41.9\n    }\n  }\n}\nmetric: {\n  label: {\n    name: \"species\"\n    value: \"litoria-caerulea\"\n  }\n  summary: {\n    sample_count: 1000\n    sample_sum: 29969.50000000001\n    quantile: {\n      quantile: 0.5\n      value: 31.1\n    }\n    quantile: {\n      quantile: 0.9\n      value: 41.3\n    }\n    quantile: {\n      quantile: 0.99\n      value: 41.9\n    }\n  }\n}\n"
        	            	actual  : "name:  \"pond_temperature_celsius\"\nhelp:  \"The temperature of the frog pond.\"\ntype:  SUMMARY\nmetric:  {\n  label:  {\n    name:  \"species\"\n    value:  \"leiopelma-hochstetteri\"\n  }\n  summary:  {\n    sample_count:  0\n    sample_sum:  0\n    quantile:  {\n      quantile:  0.5\n      value:  nan\n    }\n    quantile:  {\n      quantile:  0.9\n      value:  nan\n    }\n    quantile:  {\n      quantile:  0.99\n      value:  nan\n    }\n  }\n}\nmetric:  {\n  label:  {\n    name:  \"species\"\n    value:  \"lithobates-catesbeianus\"\n  }\n  summary:  {\n    sample_count:  1000\n    sample_sum:  31956.100000000017\n    quantile:  {\n      quantile:  0.5\n      value:  32.4\n    }\n    quantile:  {\n      quantile:  0.9\n      value:  41.4\n    }\n    quantile:  {\n      quantile:  0.99\n      value:  41.9\n    }\n  }\n}\nmetric:  {\n  label:  {\n    name:  \"species\"\n    value:  \"litoria-caerulea\"\n  }\n  summary:  {\n    sample_count:  1000\n    sample_sum:  29969.50000000001\n    quantile:  {\n      quantile:  0.5\n      value:  31.1\n    }\n    quantile:  {\n      quantile:  0.9\n      value:  41.3\n    }\n    quantile:  {\n      quantile:  0.99\n      value:  41.9\n    }\n  }\n}\n"

Modifications

Verifying this change

  • Make sure that the change passes the CI checks.

(Please pick either of the following options)

This change is a trivial rework / code cleanup without any test coverage.

(or)

This change is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(example:)

  • Added integration tests for end-to-end deployment with large payloads (10MB)
  • Extended integration test for recovery after broker failure

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • [ X ] The metrics
  • Anything that affects deployment

Documentation

  • doc
  • doc-required
  • [ X ] doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository: pgier#12

Upgrade the prometheus client_golang library which changes the format of the metric output
to match the current tests.
@github-actions github-actions Bot added the doc-not-needed Your PR changes do not impact docs label Mar 13, 2024

@lhotari lhotari left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for the contribution @pgier

@codecov-commenter

codecov-commenter commented Mar 13, 2024

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.61%. Comparing base (bbc6224) to head (9c5cf0f).
Report is 1136 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #22260      +/-   ##
============================================
+ Coverage     73.57%   73.61%   +0.03%     
- Complexity    32624    32755     +131     
============================================
  Files          1877     1879       +2     
  Lines        139502   139794     +292     
  Branches      15299    15340      +41     
============================================
+ Hits         102638   102906     +268     
- Misses        28908    28909       +1     
- Partials       7956     7979      +23     
Flag Coverage Δ
inttests 26.48% <ø> (+1.90%) ⬆️
systests 24.39% <ø> (+0.06%) ⬆️
unittests 72.87% <ø> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 83 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants